<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>试卷信息编辑</title>
	<%
    	String path = request.getContextPath();
	    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
    %>
	<c:set var="path" value="<%=basePath %>"></c:set>
 	<link href="${path }/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
 	<link rel="stylesheet" type="text/css" href="${path }/js/zeroModal/zeroModal.css" />
 	<link href="${path }/js/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
 	<link rel="stylesheet" type="text/css" href="${path }/js/zeroModal/zeroModal.css" />
 	<style type="text/css">
 		.dropdown-toggle {
 			height: 30px;
 		}
 	</style>
</head>
<body>
	<div>
		<div class="container">
			<div class="row clearfix">
				<div class="col-md-12 column">
					<form class="form-horizontal" role="form" id="examPaperAction" action="examPaper" method="post">
						<c:if test="${examPaper.examPaperId != null }">
							<div class="form-group">
								 <label for="examPaperId" class="col-sm-2 control-label">试卷编号</label>
								 <div class="col-sm-3">
								 	<input class="form-control" id="examPaperId" name="examPaperId" type="text" value="${examPaper.examPaperId }" readonly="readonly" unselectable='on' onfocus='this.blur()' />
								 </div>
								 	<input type="hidden" value="${examPaper.examPaperId}" name="isupdate" id="isupdate" class="form-control" />
							</div>
						</c:if>
						<c:if test="${subject==null }">
							<c:if test="${examPaper.examPaperId != null }"></c:if>
								<div class="form-group" ${examPaper.examPaperId != null ? "style='display: none'" : "style='display:block'"}>
									<div style="float:left;line-height:20px;margin-left: 9%"><label class="col-sm-0 control-label">课程</label></div>
									<div class="col-sm-2" style="float:left">
										<select class="form-control" id="courseid" name="curriculumId">
											<option value="0">请选择</option>
										</select>
									</div>
									<div style="float:left;line-height:20px"><label class="col-sm-0 control-label">章节</label></div>
									<div class="col-sm-2" style="float:left">
					                    <select class="form-control" id="chapterid" name="chapterId">
											<option value="0">请选择</option>
										</select>
										<div style="display: none"><select id="pointsid" name="knowledgeId"><option value="0">请选择</option></select></div>
									</div>
								</div>
						</c:if>
						<div class="form-group">
							 <label for="examPaperEasy" class="col-sm-2 control-label">难易程度</label>
							<div class="col-sm-5">
								<select class="selectpicker" name="examPaperEasy" id="examPaperEasy" data-live-search="true">
										<c:if test="${examPaper.examPaperEasy == null }">
											<option value="0" style="display: none;">--请选择--</option>
										</c:if>
										<option value="${examPaper.examPaperEasy }" style="display: none;">
											<c:if test="${examPaper.examPaperEasy== 0 }">
												简单
											</c:if>
											<c:if test="${examPaper.examPaperEasy == 1 }">
												普通
											</c:if>
											<c:if test="${examPaper.examPaperEasy == 2 }">
												困难
											</c:if>
										</option>
										<option value="0">简单</option>
										<option value="1">普通</option>
										<option value="2">困难</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="examPaperName" class="col-sm-2 control-label">试卷名称</label>
							<div class="col-sm-5">
								<input class="form-control" id="examPaperName" name="examPaperName" type="text" value="${examPaper.examPaperName }" placeholder="试卷名称" />
							</div>
						</div>
						<div class="form-group">
							 <label for="exampaperTitle" class="col-sm-2 control-label">试卷题头</label>
							<div class="col-sm-5">
								<textarea name="exampaperTitle" id="exampaperTitle" cols="40" rows="4" class="form-control" placeholder="试卷题头">${examPaper.exampaperTitle }</textarea>
							</div>
						</div>
						<div class="form-group">
							 <label for="subjectNum" class="col-sm-2 control-label">试题数量</label>
							<div class="col-sm-5">
								<c:if test="${examPaper != null }">
									<input class="form-control" id="subjectNum" name="subjectNum" type="text" value="${examPaper.subjectNum }" readonly="readonly" unselectable='on'/>
								</c:if>
								<c:if test="${examPaper == null }">
									<input class="form-control" id="subjectNum" name="subjectNum" type="text" value="0" readonly="readonly" unselectable='on' onfocus='this.blur()' />
								</c:if>
							</div>
						</div>
						<div class="form-group">
							 <label for="examPaperScore" class="col-sm-2 control-label">试卷总分</label>
							<div class="col-sm-5">
								<c:if test="${examPaper != null }">
									<input class="form-control" id="examPaperScore" name="examPaperScore" type="text" value="${examPaper.examPaperScore }" readonly="readonly" unselectable='on' />
								</c:if>
								<c:if test="${examPaper == null }">
									<input class="form-control" id="examPaperScore" name="examPaperScore" type="text" value="0" readonly="readonly" unselectable='on' onfocus='this.blur()' />
								</c:if>
							</div>
						</div>
						<div class="form-group">
							 <label for="examPaperTime" class="col-sm-2 control-label">考试时长</label>
							<div class="col-sm-5">
								<select class="selectpicker" name="examPaperTime" id="examPaperTime" data-live-search="true">
										<c:if test="${examPaper.examPaperTime == null }">
											<option value="0" style="display: none;">--请选择考试时长--</option>
										</c:if>
										<option value="${examPaper.examPaperTime}" style="display: none;">
											${examPaper.examPaperTime}分钟
										</option>
										<option value="60">60分钟</option>
										<option value="80">80分钟</option>
										<option value="100">100分钟</option>
										<option value="120">120分钟</option>
										<option value="120">150分钟</option>
								</select>
							</div>
						</div>
						<br />
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-4">
								 <button id="sub" uUrl="examPaperUpdate" aUrl="examPaperAdd" type="button" class="btn btn-default btn-lg btn-block">
							 		提交
								 </button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	    <div class="modal-dialog">
	        <div class="modal-content">
	           <form action="" id="mytbody">
		           <div class="modal-header">
		                <!-- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> -->
		                <table class="table table-striped">
						  <caption>知识点<span style="color:red">(题目数不能超过50道)</span></caption>
						  <thead>
						    <tr>
						      <th>id</th>
						      <th>知识点</th>
						      <th>选题数</th>
						      <th>题目数</th>
						    </tr>
						  </thead>
						  <tbody id="cha"></tbody>
						</table>
		            </div>
		            <div class="modal-footer">
		                <button type="button" class="btn btn-primary" onclick="saveKnowledge()">保存</button>
		            </div>
	           </form>
	        </div><!-- /.modal-content -->
	    </div><!-- /.modal-dialog -->
	</div>

	<!-- js引入 -->
    <script src="${path }/js/jquery.js"></script>
    <script src="${path }/js/bootstrap/bootstrap.min.js"></script>
    <script src="${path }/js/zeroModal/zeroModal.min.js"></script>
    <script src="${path }/js/add-update.js"></script>
    <script src="${path }/js/bootstrap-select/bootstrap-select.min.js"></script>
    <script type="text/javascript" src="${path }/js/examPaper/examPaperedit.js"></script>
    <script type="text/javascript">
    	$('.selectpicker').selectpicker({
    	    style: 'btn-default',
    	    size: 8
    	});
    </script>
</body>
</html>